open SwfTypes

val new_mobj: string -> 'a jhmtasc_type -> int
val call_method: int -> string -> 'a jhmtasc_type -> 'a jhmtasc_type
val getMField: 'a jhmtasc_type -> string -> 'a jhmtasc_type
val setMField: 'a jhmtasc_type -> 'a jhmtasc_type -> 'a jhmtasc_type

val asInt: 'a jhmtasc_type -> int
val asIntOption: 'a jhmtasc_type -> int option
val asBool: 'a jhmtasc_type -> bool
val asString: 'a jhmtasc_type -> string
val asList: 'a jhmtasc_type -> jdynarray
val asMap: 'a jhmtasc_type -> jhashtable
(*
val asStringList: 'a jhmtasc_type -> string_list
*)
val emptyJNup: 'a jhmtasc_type
(* TODO refactor to Map.eg. mapCreate - mapFind etc... *)
val mapCreate: 'a jhmtasc_type list -> jhashtable
val mapFind: jhashtable -> 'a jhmtasc_type -> 'a jhmtasc_type
val mapMem: jhashtable -> 'a jhmtasc_type -> bool
val mapAdd: jhashtable -> 'a jhmtasc_type -> 'a jhmtasc_type -> unit
val mapReplace: jhashtable -> 'a jhmtasc_type -> unit
val mapGet: jhashtable -> 'a jhmtasc_type -> 'a jhmtasc_type
(* TODO it's uggly try to remove that*)
val mapGetKey: jhashtable -> 'a jhmtasc_type -> 'a jhmtasc_type
val mapRemove: jhashtable -> 'a jhmtasc_type -> unit
val mapLength: jhashtable -> int
val mapFold: ('a -> 'b -> 'c -> 'c) -> jhashtable -> 'c -> jhashtable
(*
            let idents = hashTableFold (fun ident pos acc -> (identact,pos) :: acc) idents [] in
            let idents = List.sort (fun (_,p1) (_,p2) -> compare p1 p2) idents in
*)

(* rename constructor to listCreate ... *)
val listCreate: 'a jhmtasc_type list -> jdynarray
val listRev: jdynarray -> unit
val listAdd: jdynarray -> 'a jhmtasc_type -> unit
val listInsert: jdynarray -> int -> 'a jhmtasc_type -> unit
val listLast: jdynarray -> 'a jhmtasc_type
val listRemoveLast: jdynarray -> unit
val listLength: jdynarray -> int
val listSet: jdynarray -> int -> 'a jhmtasc_type -> unit
val listGet: jdynarray -> int -> 'a jhmtasc_type
val listFoldLeft: ('a -> 'b -> 'a) -> 'a -> jdynarray -> 'a
val listExists: jdynarray -> 'a jhmtasc_type -> bool
val listRemove: jdynarray -> int -> unit
val listConcat: jdynarray -> jdynarray -> jdynarray

(* providing new types instead of using tuples *)
val newLocalCtx: int -> int -> jlocal_ctx
val newSuperBindingsObj: string_list -> string -> bool -> jsuper_bindings_obj
val newTagsObj: string -> jhashtable -> jdynarray -> jtags_obj

(* extra method *)
val stringSplit: string -> string -> jdynarray
val toStringList: jdynarray -> string list

val newTag: int -> bool -> tag_data -> tag
val newClip: int -> int -> 'a jhmtasc_type list -> clip
val asExport: 'a jhmtasc_type -> export
val newExport: int -> string -> export
val newDoInitAction: int -> int -> int

val asAction: 'a jhmtasc_type -> action
val newAction: action_type -> action

(*
val asActionType: action -> action_type
val asActions: 'a jhmtasc_type -> actions
val newActions: action_type list -> jdynarray


val asPushItemType: push_item -> push_item_type
val asPushItem: 'a jhmtasc_type -> push_item
val newPushItems: push_item list -> jdynarray


val newTry: try_style_type -> int -> int option -> int option -> try_block
val getTryStyleType: try_block -> try_style_type

val asFlagsList: 'a jhmtasc_type -> f2_flagsList
val asFunc2Decl: 'a jhmtasc_type -> function_decl2

val asFuncDecl: 'a jhmtasc_type -> function_decl

val newFunc2Decl: string -> f2_flagsList -> (int * string) list -> int -> action_count -> function_decl2


val newFuncDecl: string -> string_list -> int -> function_decl
*)